﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Models;

public partial class AdminAdd : AdminBase
{
    public int _Id = 0;
    public string CPower="";

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.CacheControl = "no-cache";

        if (!string.IsNullOrEmpty(Request.Params["ID"]))
        {
            _Id = int.Parse(HttpContext.Current.Request.QueryString["ID"]);
        }
        if (!Page.IsPostBack)
        {
            if (_Id != 0)
            {
                using (Entities db = new Entities())
                {
                    //CPower = db.WXUserInfo.SingleOrDefault(p => p.UId == _Id);
                }
            }
            //GetMenuString();
        }
    }

    //保存
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Entities mydb = new Entities();
        {
            var ws = mydb.WXUserInfo.First(p => p.UId == _Id);
           // ws.Power = TextBox1.Text.Trim();
            mydb.SaveChanges();
            Response.Write("<script> var Close=1;</script>");
        }
    }
    //protected void GetMenuString()
    //{
    //    Entities db = new Entities();
    //   // var Bpl = db.S_Goods;
    //    StringBuilder sb = new StringBuilder();
    //    foreach (var menu in Bpl)
    //    {
    //        sb.Append("<table class=\"footable table table - stripped toggle - arrow - tiny footable - loaded\" ><tr>\r\n");

    //        sb.Append("<td  align=left class=\"menu_title1\" ><input type=checkbox  name=\"admin_power\" class=\"checkall checkbox-inline i-checks\" value=\"");
    //        sb.Append(menu.GID + "\"");
    //        if (_Id != 0)
    //        {
    //            if (CPower.IndexOf("," + menu.GID + ",") > -1)
    //                sb.Append(" checked");
    //        }
    //        sb.Append("/>");

    //        sb.AppendFormat("<b>{0}</b></td></tr>\r\n", menu.GName);

    //        sb.AppendFormat("<tr><td  align=left><ul class=\"sec_menu\" menuid=\"{0}\">\r\n", menu.GID);
    //        sb.Append("</ul></td></tr></table><br>\r\n");
    //    }
    //    ltMasterSetting.Text = sb.ToString();
    //}
}



